﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using KpBusiness.Model;

using System.Web.Mvc;
namespace KpMis.Utility
{
    public class SecurityHelper
    {
        public static Candidate UpdateCandidateWithLogonInfo(Candidate candidate)
        {

         UserInformation ui = (UserInformation) HttpContext.Current.Session[ConstantMaster.UserSessionString];
                candidate.UserInformation = ui;
                return candidate;
        }

        public static UserInformation GetLiveUser()
        {

            UserInformation ui = (UserInformation)HttpContext.Current.Session[ConstantMaster.UserSessionString];
            return ui;
        }


        public static bool IsCurrentUserAdminOrManager()
        {

            UserInformation ui = (UserInformation)HttpContext.Current.Session[ConstantMaster.UserSessionString];
            if (ui.Role.GroupType == GroupTypes.Admin || ui.Role.GroupType == GroupTypes.Manager)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}